package installer.user;

import org.springframework.jdbc.core.JdbcTemplate;

public class InstallUser {
	/*private static JdbcTemplate jdbcTemplate;

	@BeforeClass
	public static void before() {
		ApplicationContext ctx = new ClassPathXmlApplicationContext(
				"config/context/applicationContext.xml");
		jdbcTemplate = (JdbcTemplate) ctx.getBean("jdbcTemplate");
	}

	@Test*/
	public static  void install(JdbcTemplate jdbcTemplate,String sql) {
		try {
			/*String sql=
					"CREATE TABLE `user` (`userid`  bigint NOT NULL AUTO_INCREMENT,"
			+"`email`  varchar(60) NOT NULL ,"
			+"`password`  varchar(40) NOT NULL ,"
			+"`portrait`  varchar(40) NOT NULL ,"
			+"`createDate`  datetime NOT NULL ,"
			+"`updateTime`  datetime NOT NULL ,"
			+"`lastLoginIP`  varchar(20) NULL ,"
			+"`lastLoginTime`  datetime NOT NULL ,"
			+"`nickName`  varchar(60) NOT NULL ,"
			+"`name`  varchar(40) NULL ,"
			+"`birthday`  date NULL ,"
			+"`province`  varchar(50) NULL ,"
			+"`city`  varchar(50) NULL ,"
			+"`country`  varchar(50) NULL ,"
			+"`siteid`  varchar(9) NULL ,"
			+"`job`  varchar(20) NULL ,"
			+"`sex`  enum('female','male') NULL ,"
			+"`graduateSchool`  varchar(100) NULL ,"
			+"`mobilephone`  varchar(20) NULL ,"
			+"`msn`  varchar(60) NULL ,"
			+"`qq`  varchar(20) NULL ,"
			+"`authority`  tinyint NOT NULL ,"
			+"`securityQuestion`  varchar(40) NULL ,"
			+"`securityAnswer`  varchar(40) NULL ,"
			+"`securityEmail`  varchar(60) NULL ,"
			+"`activity`  enum('normal','frozen','deleted','undeletable') NOT NULL ,"
			+"PRIMARY KEY (`userid`),"
			+"UNIQUE INDEX `email` (`email`)" 
			+")"
			+";";*/
				
			//String sql = "CREATE TABLE user (id  int(20)  NOT NULL AUTO_INCREMENT primary key,username  varchar(40) NOT NULL ,password  varchar(40) NOT NULL ,email  varchar(60) NOT NULL ,nickname  varchar(40) NOT NULL ,createdate  date NOT NULL ,activity  tinyint(1) NOT NULL ,UNIQUE INDEX username (username) ,UNIQUE INDEX id (id) )ENGINE=InnoDB;";
			jdbcTemplate.update(sql);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
//	CREATE TABLE `user` (
//			`userid`  int NOT NULL ,
//			`email`  varchar(60) NOT NULL ,
//			`password`  varchar(40) NOT NULL ,
//			`portrait`  varchar(40) NOT NULL ,
//			`createdate`  date NOT NULL ,
//			`updatetime`  date NOT NULL ,
//			`lastloginIP`  varchar(20) NULL ,
//			`lastlogintime`  date NOT NULL ,
//			`nickname`  varchar(60) NOT NULL ,
//			`name`  varchar(40) NULL ,
//			`birthday`  date NULL ,
//			`province`  varchar(50) NULL ,
//			`city`  varchar(50) NULL ,
//			`country`  varchar(50) NULL ,
//			`siteid`  varchar(9) NULL ,
//			`job`  varchar(20) NULL ,
//			`sex`  enum('female','male') NULL ,
//			`graduateschool`  varchar(100) NULL ,
//			`mobilephone`  varchar(20) NULL ,
//			`msn`  varchar(60) NULL ,
//			`qq`  varchar(20) NULL ,
//			`authority`  tinyint NOT NULL ,
//			`securityquestion`  varchar(40) NULL ,
//			`securityanswer`  varchar(40) NULL ,
//			`ecurityEMail`  varchar(60) NULL ,
//			`activity`  enum('normal','frozen','deleted') NOT NULL ,
//			PRIMARY KEY (`userid`),
//			UNIQUE INDEX `email` (`email`) 
//			)
//			;
}
